<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">

<?php 
	if (!isset($_SESSION)) {
		session_start();
	}
	require "php/managesession.php";
?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<link rel="stylesheet" type="text/css" href="css/style.css" />
	<script type="text/javascript" src="javascript/foodholic.js"></script>
	<script type="text/javascript" src="javascript/like.js"></script>
	<script type="text/javascript" src="javascript/Konten.js"></script>
	<script type="text/javascript" src="javascript/ajax.js"></script>
	<script type="text/javascript">onLoad();</script>
	
	<title>Konten</title>
</head>

<body>
	<?php
	$w = $_GET['ID'];
	require "header.php"; 
	require "php/akses.php";
	require "php/render.php";
	connect();
	if (isLogin())
		view(getLoginUserid(),$w);
	$hasil = getContentDetail($w);
	$komen = $hasil['user_comments'];
	?>
		<div id="content">
			
			<div id="main_content">
				<div id="content_image"> <?php echo render($hasil) ?>
						<div id="like_dislike">
							<a onmouseover="" style="cursor: pointer;" onclick="return likeThis('like1');" id="staty">
								<img src="images/like.png" alt="post" name="gambarLike"/>
							</a>
							<a onmouseover="" style="cursor: pointer;" onclick="return dislikeThis('like1');">
								<img src="images/dislike.png" alt="post"/>
							</a>
							<div class="LikeCount">
								<h4> people like: <?php echo "{$hasil['likes']}"; ?></h>
							</div>
						</div>
				</div>
				<div> <a id="statlike1"> </a></div>
				
				
				<div id="content_info">
					<div id="content_title">
						<h2><?php echo "{$hasil['judul']}"; ?></h2>
					</div>
				</div>
				
				
				<br /><br />
				<div id="comments"><img src="images/Comment.png" alt=""/>
					<br /><br />
					<div id="post_comments">
							<div class="mainContent">
												
								<div class="postComment">
									<textarea cols="0" rows="0" class="postText" id="TextArea" onfocus="if (this.value=='Put Your Comment Here...') {this.value='';}" onblur="if (this.value=='') {this.value='Put Your Comment Here...';}">Put Your Comment Here...</textarea>
									<button class="postCommentButton"  type="button" onclick="submitHandler(<?php echo getLoginUserid(); ?>,<?php echo $w; ?>);"> Submit </button>
									<br/> <br/> <br/> <br/>
								</div>
							</div>
					</div>
					
					<div id="isicomment">
					
					<?php
					for ($i=0; $i<sizeof($komen); $i++)
					{

						$apalah = $komen[$i];
						$selisih = getContentTimeInterval($apalah['waktu']);
							echo " <div class='comment_list'>
								<div class='komen_content'>
									<div class='avatarkonten'><img src='${apalah['avatar_path']}' />
									</div>
									<div class=/commenkonten'>
										<a href='profil.php?id=${apalah['ID_user']}'> <strong>  ${apalah['username']}  </strong> </a>
										<br /> 
										<strong> ${selisih['selisih']} ${selisih['satuan']} </strong>
										<h5> '${apalah['isi']}' </h5>"
										. (((isLogin() == true) && ($apalah['ID_user'] == getLoginUserid())) ? "<button class='deleteCommentButton'  type='button' onclick='submitdelete($w, ${apalah['ID_komentar']})'> Delete </button>" : "") .
									"</div>
								</div>					
						</div>";
						
					}?>
					
					
					
					</div>
				</div>
			</div>
			
		</div>
		
	<?php require "footer.php"; ?>
		
	</div>
</body>
</html>
